package com.four.reimbursemanage.controller;

import com.four.reimbursemanage.common.bean.ResponseData;
import com.four.reimbursemanage.common.controller.BaseController;
import com.four.reimbursemanage.entity.EntertainApply;
import com.four.reimbursemanage.service.EntertainApplyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.*;

import java.util.Date;

@RestController
@CrossOrigin
@RequestMapping("/entertainApply")
public class EntertainApplyController extends BaseController {

    @Autowired
    private EntertainApplyService entertainApplyService;
    /**
     * 查询支付申请列表
     */
    @GetMapping("/entertainApplyList")
    public ResponseData<Object> getPayapply(
            @RequestParam("pageNum") int pageNum,
            @RequestParam("pageSize") int pageSize,
            @RequestParam(value = "month",required = false)@DateTimeFormat(pattern = "yyyy-MM-dd") Date month,
            @RequestParam(value = "is_settlement",required = false) Integer is_settlement
    ){
        System.out.println(month);
        return returnObject(entertainApplyService.getOnrePage(pageNum, pageSize, month, is_settlement));
    }

    /*结算*/
    @PutMapping("/updateS")
    public  ResponseData<Boolean> updateS(@RequestBody EntertainApply entertainApply) {
        return returnBoolean(entertainApplyService.updateSuccess(entertainApply));
    }
}
